<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html  xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="<%=basePath%>">
<title>车险销售渠道信息维护</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<style type="text/css">
.agentClass {
	color: red;
	padding-left:4px;
}
.dialogTitle {
	height: 21px;
	line-height: 21px;
	margin-top:10px;
	color: #333;
	font-weight: bold;
	font-size: 14px;
	text-align:center;
}
.internalNlifeInput {
	border:1px #cdcbd0 solid;
	color:#323232;
	width:130px;
	height:22px;
	line-height:22px;
}
.internalNlifeSelect {
	border:1px #cdcbd0 solid;
	color:#323232;
	width:130px;
	height:22px;
	line-height:22px;
}
.nlifeServiceDivInput{
	border:1px #cdcbd0 solid;
	color:#323232;
	width:140px;
	height:23px;
	line-height:22px;
}
.nlifeAgentDivInput{
	border:1px #cdcbd0 solid;
	color:#323232;
	width:140px;
	height:23px;
	line-height:22px;
}
</style>
<script type="text/javascript">
	var nocarConfigurationTr;

	//当前产品类型
	var currentProductType;
function Map(){
	  this.elements = new Array();
	   //获取MAP元素个数
	   this.size = function() {
	       return this.elements.length;
	   };
	   //判断MAP是否为空
	   this.isEmpty = function() {
	       return (this.elements.length < 1);
	   };
	   //删除MAP所有元素
	   this.clear = function() {
	       this.elements = new Array();
	   };
	   //向MAP中增加元素（key, value)
	   this.put = function(_key, _value) {
	       if(this.containsKey(_key)){
	        this.remove(_key);
	        this.elements.push( {
	           key : _key,
	           value : _value
	        });
	       }else{
	        this.elements.push( {
	           key : _key,
	           value : _value
	        });
	       }  
	   };
	   //删除指定KEY的元素，成功返回True，失败返回False
	   this.remove = function(_key) {
	       var bln = false;
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   this.elements.splice(i, 1);
	                   return true;
	               }
	           }
	       } catch (e) {
	           bln = false;
	       }
	       return bln;
	   };
	   //获取指定KEY的元素值VALUE，失败返回NULL
	   this.get = function(_key) {
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   return this.elements[i].value;
	               }
	           }
	       } catch (e) {
	           return false;
	       }
	       return false;
	   };
	   //判断MAP中是否含有指定KEY的元素
	   this.containsKey = function(_key) {
	       var bln = false;
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   bln = true;
	               }
	           }
	       } catch (e) {
	           bln = false;
	       }
	       return bln;
	   };
	  //获取map的所有values
	  this.values = function() {
	       var arr = new Array();
	       for (var i = 0; i < this.elements.length; i++) {
	           arr.push(this.elements[i].value);
	       }
	       return arr;
	   };
	  //获取map的所有keys
	  this.keys= function() {
	       var arr = new Array();
	       for (var i = 0; i < this.elements.length; i++) {
	           arr.push(this.elements[i].key);
	       }
	       return arr;
	   };
	   //获取数组
	   this.getArray= function(){
	   	var arr = new Array();
	   	for (var i = 0; i < this.elements.length; i++) {
	           arr.push({
		            key : this.elements[i].key,
		            value : this.elements[i].value
		         });
	       }
	       return arr;
	   };
	}
	var agentType = 4;
	var newBsnsTypeStr = "A0302,A0402,A0502,B0104,B0202,D0404,D0504,D0302,E0202,E0302,W0102,W0202,H0902,H0302";
	var deptCodeStr = "32,86,33";
	var internalTradInfo = "";
	var externalTradInfo = "";
	var externalTradInfo_agent = "";
	var externalTradInfo_agentName = "";
	var externalTradInfo_service = "";
	$(document).ready(function(){
	$("#channelCodeQD").change(function(){
		var parentCode = $("#channelCodeQD").val();
		subDropDownList("channel_type",parentCode,"channelType");
		subDropDownList("new_business_source","","newBsnsType");
	});
	$("#channelType").change(function(){
		var parentCode = $("#channelType").val();
		subDropDownList("new_business_source",parentCode,"newBsnsType");
		if(parentCode==''){
			$("#bsnsType").val('');
		}
	});
	
	$("#newBsnsType").change(function(){
		var newBsnsType = $("#newBsnsType").val();
		var deptCode = $("#deptCode_div").val();
		if(newBsnsTypeStr.indexOf(newBsnsType) != -1){
			$("#C_AGENCY_CDE_ID").html("个人执业证号：")
		}else{
			if(deptCodeStr.indexOf(deptCode.substr(0,2)) != -1){
				$("#C_AGENCY_CDE_ID").html("组织机构代码证号：")
			}else{
				$("#C_AGENCY_CDE_ID").html("机构许可证号：")
			}
		}		
	});
	$("#bsnsType").change(function(){
		var newBsnsCode = $("#newBsnsType").val();
		var bsnsTypeCode = $("#bsnsType").val();
		//原业务来源为19002-代理或19003-经纪，则代理人代码和代理协议号必填，其他非必填
		if(bsnsTypeCode.substr(0,5)!="19002"&&bsnsTypeCode.substr(0,5)!="19003"){
			$(".agentClass").html("");
		}else{
			$(".agentClass").html("*");
		}
	});
	$(".nlifeTradInfo_internal").hide();
	$(".nlifeTradInfo_external").hide();
	queryAgentMtInfo(1)
});

	function queryAgentMtInfo(pageIndex){
		$.openLoading();
		var size = 10;
		var channelCode = $("#channelCode_s").val();
		var dptCde = $("#dept_s").val();
		var subChannelCode = $("#subChannelCode").val();
		var subChannelName = $("#subChannelName").val();
		$.ajax({
			url:"carDataManagement/carAgentInfoPageQuery",
			type:"POST",
			data:{"current":pageIndex,"size":size,"channelCode":channelCode,"dptCde":dptCde,"subChannelCode":subChannelCode,"subChannelName":subChannelName},
			dataType:"json",
			async:"true",
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;
				if(null != page){
 					var buttonStr = '';

					buttonStr += "<a href='javascript:void(0)' onClick='nlifeConfiguration(this);return false'>车加非车信息配置</a></br><a href='javascript:void(0)' onClick='editAgentMtInfo(this);return false'>编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)' onClick='deleteSalesInfoDiv($(this));return false'>删除</a><br/><a href='javascript:void(0)' onClick='openSalesInfoDiv(this);return false'>广东销售信息配置</a>";
					var fieldNames = "id@TDH,channelCode,subChannelCode,dptCde,channleCode@TDH,channleType@TDH,newBsnsType,categoryCode@TDH,agentNo,cbrkrname,protocolNo,serviceCode,empNo@TDH,empName@TDH,teamCode@TDH,teamName@TDH,cAgentCode@TDH,coprcod@TDH,cSaleName@TDH,cSlsIdentItyNo@TDH,repairCode@TDH,repairName@TDH,cPhone@TDH,empPhone@TDH,jqMax@TDH,jqMin@TDH,syMax@TDH,syMin@TDH,key1@TDH"; 
					var tableContent = creatTable(fieldNames,page,buttonStr);
					var tableObj = $("#agentInfoTable");
					tableObj.find("tbody").remove();
					tableObj.append(tableContent);
					var strPage = creatChannelPage(page.current,10,page.maxPage,"28");
					var pageDIV = $("#agentInfoPageDIV");
					pageDIV[0].innerHTML="";
					pageDIV.append(strPage);
				}
			}
		})
	}
function subDropDownList(codeType,element1,element2,element3){
	$.ajax({
		url : "<%=path%>/carDataManagement/loadSubDropList",
		type : 'POST',
		async : false,
		data:{codeType:codeType,parentCode:element1},
		dataType:'json',
		success:function(appList){
			if($.validate(appList))  return;
			var appSelect = document.getElementById(element2);
			appSelect.options.length = 0;
			if (appList != null) {
				for (var i = 0; i < appList.length; i++) {
					var option = new Option();
					option.text = appList[i].codeName;
					option.value = appList[i].code;
					appSelect.add(option);
				}
			}
       	}
	});
}
	function agentExcelDownload(){
		window.location.href='<%=basePath%>'+"carDataManagement/templateDownload"
	}
	var handleFlag="";
	function addAgentInfo(){
		$("#addOrUpdateDiv").OpenDiv();
		var a = $("#channelCode_s").text();
		handleFlag="save";
	}
	function closeAddOrUpdateDiv(){
		$("#branch_div").val("");
		$("#branchName_div").val("");
		$("#partnerCode_div").val("");
		$("#deptCode_div").val("");
		$('#channelCodeQD').val("");
		$('#channelType').val("");
		$('#newBsnsType').val("");
		$('#bsnsType').val("");
		$("#agentNo_div").val("");
		$("#protocolNo_div").val("");
		$("#cbrkrname_div").val("");
		$("#serviceCode_div").val("");
		$("#serviceName_div").val("");
		$("#empNo_div").val("");
		$("#empName_div").val("");
		$("#teamCode_div").val("");
		$("#teamName_div").val("");
		$("#C_AGENCY_CDE").val("")
		$("#C_OPR_CDE").val("");
		$("#C_SALE_NME").val("");
		$("#C_SLS_IDENTITY_NO").val("");
		$("#REPAIR_CODE").val("");
		$("#REPAIR_NAME").val("");
		$("#C_PHONE").val("");
		$("#EMP_PHONE").val("");
		$('#branch_div').attr("readonly",false).css('background-color','white');
		$("#JQ_Max").val("");
		$("#JQ_Min").val("");
		$("#SY_Max").val("");
		$("#SY_Min").val("");
		$("#JQ_Max_Id").val("");
		$("#JQ_Min_Id").val("");
		$("#SY_Max_Id").val("");
		$("#SY_Min_Id").val("");
		$('#channelCodeQD').attr("disabled",false).css('background-color','white');
		$('#channelType').attr("disabled",false).css('background-color','white');
		$('#newBsnsType').attr("disabled",false).css('background-color','white');
		$('#bsnsType').attr("disabled",false).css('background-color','white');
		$("#agentNo_div").attr("disabled",false).css('background-color','white');
		$("#partnerCode_div").attr("disabled",false).css('background-color','white');
		$("#addOrUpdateDiv").CloseDiv();
	}
	var divLevel = "";
	function openThisDiv(divObj,pageIndex,cur,divCount){
		$('#channelCode').val('');
		$('#channelName').val('');
		queryTradPartners(pageIndex,divLevel);
		divLevel = divCount;
	}
	function queryTradPartners(pageIndex){
		var size = 8;
		var channelCode = $('#channelCode').val();
		var channelName = $('#channelName').val();
		queryPartner({current:pageIndex,size:size,channelCode:channelCode,channelName:channelName});
	}
	function queryPartner(param){
		$("#BigDiv2").remove();
		$.openLoading();
		$.ajax({
			url : "carDataManagement/loadCarChannelInfo",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(partnerPage){
				$.closeLoading();
				if($.validate(partnerPage))return;
						var radioObj ="<input class='input_fxk' name='partnerradio' type='radio' value=''>";
						var fieldNames = "channelCode@TDH,channelCode,channelName,transType@TDH";
						var tableContent = creatTable1(fieldNames,partnerPage,radioObj);
						var tableObj = $("#TradPartnerTable");
						tableObj.find("tbody").remove();
						tableObj.append(tableContent);
						
						var strPage = creatChannelPage2(partnerPage.current,6,partnerPage.maxPage,"16");
						var pageDIV = $("#TradPartnerPageDIV");
						pageDIV[0].innerHTML="";
						pageDIV.append(strPage);
						$('#tradPartnerDiv').OpenDiv2();
						bindradio();
				}
		});
		
	}
	function closeCurrentDIV(obj){
		if(('3' == divLevel || '1'== divLevel && obj == 'tradPartnerDiv' ) || 'deptDiv' == obj || 'subTradPartnerDiv' == obj){
			$("#"+obj).CloseDiv2();
		}else{
			$("#"+obj).CloseDiv();
		}
		divLevel="";
	}
	function bindradio(){
		$("input[name='partnerradio']").click(function(){
			$("input[name='partnerradio']").parent().parent().removeClass("table_highlighter");
			$(this).parent().parent().addClass("table_highlighter");
	   	});
		$("input[name='deptradio']").click(function(){
			$("input[name='deptradio']").parent().parent().removeClass("table_highlighter");
			$(this).parent().parent().addClass("table_highlighter");
	   	});
	}
	function choosePartner(){
		var selectedPartner = $("input[name='partnerradio']:checked");
		if(selectedPartner.length==0){
			$.message("error", "请选择一个合作伙伴");
			return;
		}
		var partner = selectedPartner.parent().parent().children("td:eq(1)").html();
		if('3' == divLevel){
			$('#partnerCode_div').val(partner);
			$('#deptCode_div').val('');
		}else if('1' == divLevel){
			$("#channelCode_s").val(partner);
		}
		inputBtn();
		closeCurrentDIV('tradPartnerDiv');
	}
	function inputBtn(){
		empInfoWrite();
		teamInfoWrite();
	}
	function empInfoWrite(){
		$('#empNo_select_div').css('display','none').val("");
		$('#empNo_div').show().val('');
		$('#empName_div').attr("readonly",false).css('background-color','white').val('');
	}
	function teamInfoWrite(){
		$('#teamCode_select_div').css('display','none').val("");
		$('#teamCode_div').show().val('');
		$('#teamName_div').attr("readonly",false).css('background-color','white').val('');
	}
	function openDeptDiv(pageIndex,obj){
		if($.trim($('#partnerCode_div').val()).length==0){
			$.message("error", "请先选择合作伙伴代码");
			return;
		} 
		$('#deptcode').val('');
		$('#deptcnname').val('');
		$("#"+obj.id).blur();
		queryCoreDept(pageIndex);
	}
	function openDeptDiv2(pageIndex,obj){
		$('#deptcode').val('');
		$('#deptcnname').val('');
		$("#"+obj.id).blur();
		queryCoreDept(pageIndex);
	}
	function queryCoreDept(pageIndex){
		var size = 8;
		var code = $('#deptcode').val();
		var name = $('#deptcnname').val();
		var pno = $('#partnerCode_div').val();
		queryAllDepts({size:size,current:pageIndex,deptCode:code,deptName:name});
	}
	function queryAllDepts(param){
		$("#BigDiv2").remove();
		$.openLoading();
		$.ajax({
			url : "carDataManagement/loadCoreDept",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(deptPage){
				$.closeLoading();
				if($.validate(deptPage))return;
						var radioObj ="<input class='input_fxk' name='deptradio' type='radio' value=''>";
						var fieldNames = "DEPT_CODE,DEPT_CNAME";
						var tableContent = creatTable1(fieldNames,deptPage,radioObj);
						var tableObj = $("#deptTable");
						tableObj.find("tbody").remove();
						tableObj.append(tableContent);
						var strPage = creatChannelPage3(param.current,6,deptPage.maxPage,"18");
						var pageDIV = $("#deptPageDIV");
						pageDIV[0].innerHTML="";
						pageDIV.append(strPage);
						$("#deptDiv").OpenDiv2();
						bindradio();
				}
		});
	}
	function chooseDept(){
		var selectedDept= $("input[name='deptradio']:checked");
		if(selectedDept.length==0){
			$.message("error", "请选择一个出单机构");
			return;
		}
		var deptCode = selectedDept.parent().parent().children(" td:eq(1)").html();
		var newBsnsType = $("#newBsnsType").val();
		if(newBsnsType!=""){
			if(newBsnsTypeStr.indexOf(newBsnsType) != -1){
				$("#C_AGENCY_CDE_ID").html("个人执业证号：")
			}else{
				if(deptCodeStr.indexOf(deptCode.substr(0,2)) != -1){
					$("#C_AGENCY_CDE_ID").html("组织机构代码证号：")
				}else{
					$("#C_AGENCY_CDE_ID").html("机构许可证号：")
				}
			}	
		}
		$('#deptCode_div').val(deptCode);
		if(""!=externalTradInfo){
			$('#internalNlife_deptCode').val(deptCode);
		}
		closeCurrentDIV('deptDiv');
	}
	function saveAgentMtInfo(){
		var branch = $.trim($("#branch_div").val());
		var branchName = $.trim($("#branchName_div").val());
		var channelCode = $.trim($("#partnerCode_div").val());
		var dptCde = $.trim($("#deptCode_div").val());
		var channleCode = $.trim($('#channelCodeQD').val());
		var channleType = $.trim($('#channelType').val());
		var newBsnsType = $.trim($('#newBsnsType').val());
		var categoryCode = $.trim($('#bsnsType').val());
		var agentNo = $.trim($("#agentNo_div").val());//
		var protocolNo = $.trim($("#protocolNo_div").val());
		var cbrkrname = $.trim($("#cbrkrname_div").val());
		var serviceCode = $.trim($("#serviceCode_div").val());
		var serviceName = $.trim($("#serviceName_div").val());
		var empNo = $.trim($("#empNo_div").val());
		var empName = $.trim($("#empName_div").val());
		var teamCode = $.trim($("#teamCode_div").val());
		var teamName = $.trim($("#teamName_div").val());
		var cAgentCode = $.trim($("#C_AGENCY_CDE").val())
		var coprcod = $.trim($("#C_OPR_CDE").val());
		var cSaleName = $.trim($("#C_SALE_NME").val());
		var cSlsIdentItyNo = $.trim($("#C_SLS_IDENTITY_NO").val());
		var repairCode = $.trim($("#REPAIR_CODE").val());
		var repairName = $.trim($("#REPAIR_NAME").val());
		var cPhone = $.trim($("#C_PHONE").val());
		var empPhone = $.trim($("#EMP_PHONE").val());
		var jqMax = $("#JQ_Max").val();
		var jqMin = $("#JQ_Min").val();
		var syMax = $("#SY_Max").val();
		var syMin = $("#SY_Min").val();
		if(channelCode.length == 0){
			$.message("error", "请选择合作伙伴");
			return;
		}
		var reg = new RegExp("^[A-Za-z0-9_]+$");
		if(branch.length == 0){
			$.message("error", "请输入网点代码");
			return;
		}
		if(!(reg.test(branch))){
			$.message("error", "输入的网点代码格式不正确，正确格式只能录入数字、字母、下划线组合的字符");
			return;
		}
		if(branchName.length == 0){
			$.message("error", "请输入网点名称");
			return;
		}
		if(dptCde.length == 0){
			$.message("error", "请选择出单机构");
			return;
		} else if (dptCde.length != 8) {
            $.message("error", "请选择出单机构代码为8位的出单机构");
            return;
        }
		if(channleCode.length==0){
			$.message("error", "请选择归属渠道");
			$('#channelCodeQD').focus();
			return;
		}
		if(channleType.length==0){
			$.message("error", "请选择渠道类型");
			$('#channelType').focus();
			return;
		}
		if(newBsnsType.length==0){
			$.message("error", "请选择新业务来源");
			$('#newBsnsType').focus();
			return;
		}
		if(categoryCode.length==0){
			$.message("error", "请选择原业务来源");
			$('#bsnsType').focus();
			return;
		}
		if(empNo.length == 0){
			$.message("error", "请输入业务员代码");
			return;
		}
		if(empName.length == 0){
			$.message("error", "请输入业务员名称");
			return;
		}
		if(teamCode.length == 0){
			$.message("error", "请输入团队代码");
			return;
		}
		if(teamName.length == 0){
			$.message("error", "请输入团队名称");
			return;
		}
		if(categoryCode.substr(0,5)=="19002"||categoryCode.substr(0,5)=="19003"){	
			if(agentNo.length == 0){
				$.message("error", "请输入代理人编码");
				return;
			}else if(protocolNo.length == 0){
				$.message("error", "请输入代理人协议号");
				return;
			}else if(cbrkrname.length == 0){
				$.message("error", "请输入代理人名称");
				return;
			}
		}
		if(serviceCode.length == 0){
			$.message("error", "请输入服务代码");
			return;
		}
		if(serviceName.length == 0){
			$.message("error", "请输入服务名称");
			return;
		}
		if(categoryCode.substr(0,5)=="19002"||categoryCode.substr(0,5)=="19003"){
			if(cAgentCode.length == 0){
				$.message("error", "请输入中介机构许可证号");
				return;
			}
		}		
		if(coprcod.length == 0){
			$.message("error", "请输入出单员UM工号");
			return;
		}
		if(dptCde.substring(0,2) == "83"){
			if(cSaleName.length == 0){
				$.message("error", "请输入双录人员姓名");
				return;
			}
			if(cSlsIdentItyNo.length == 0){
				$.message("error", "请输入双录人员证件号");
				return;
			}
		}
		if(channleCode == "B"){
			if(repairCode.length == 0){
				$.message("error", "请输入推荐送修码码值");
				return;
			}
			if(repairName.length == 0){
				$.message("error", "请输入推荐送修码名称");
				return;
			}
		}
		$.openLoading();
		$.ajax({
			url : "<%=path%>/carDataManagement/saveAgentMtInfo?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:{
				id:id,
				branch:branch,
				branchName:branchName,
				channelCode:channelCode,
				dptCde:dptCde,
				channleCode:channleCode,
				channleType:channleType,
				newBsnsType:newBsnsType,
				categoryCode:categoryCode,
				agentNo:agentNo,
				protocolNo:protocolNo,
				cbrkrname:cbrkrname,
				serviceCode:serviceCode,
				serviceName:serviceName,
				empNo:empNo,
				empName:empName,
				teamCode:teamCode,
				teamName:teamName,
				cAgentCode:cAgentCode,
				flag:handleFlag,
				coprcod:coprcod,
				cSaleName:cSaleName,
				cSlsIdentItyNo:cSlsIdentItyNo,
				repairCode:repairCode,
				repairName:repairName,
				cPhone:cPhone,
				empPhone:empPhone,
				agentType:agentType,
				jqMax:jqMax,
				jqMin:jqMin,
				syMax:syMax,
				syMin:syMin
			},
			dataType:'json',
			success : function(data) {
				$.closeLoading();
				if($.validate(data))return;
				queryAgentMtInfo(1);
				closeAddOrUpdateDiv();
			}
		});
	}

    <%-- 删除销售配置信息按钮事件,查询是否有意外险配置信息。 --%>
    function deleteSalesInfoDiv(obj) {
        <%-- 删除状态
        deleteAll：车险配置有关联意外险配置，一并删除
        deleteCY:只删除意外险配置
        delete：车险配置无关联意外险配置，删除车险配置
         --%>
        var flag = "";
        var message = "";
        <%-- agentID --%>
        var saleId = obj.parent().parent().children().eq(0).text().trim();
        var channelCode = obj.parent().parent().children().eq(1).text().split("-")[0].trim();
        <%-- 网点代码 --%>
        var subChannel = obj.parent().parent().children().eq(2).text().split("-")[0].trim();
        var key1 = obj.parent().parent().children().eq(-2).text().trim();
        if (subChannel.endsWith("_CY")) {
            <%-- 以_CY结尾，当前删除的为意健险网点配置信息 --%>
            flag = "deleteCY";
            message = "是否确认删除该网点数据，如点击确认，可进行删除该条网点数据";
        } else if (key1 != "") {
            <%-- key1不为空，当前车险配置有关联意外险配置信息 --%>
            flag = "deleteAll";
            message = "该车险网点数据中已关联配置意外险销售渠道数据，是否确认将车险及意外险数据一并删除，如点击确认，可将车险及意外险的网点数据一起删除";
        } else {
            <%-- 不以_CY结尾，并且没有key1关联，单车险配置 --%>
            flag = "delete";
            message = "是否确认删除该网点数据，如点击确认，可进行删除该条网点数据";
        }
        deleteSalesInfo(flag, message, saleId, channelCode, subChannel);
    }
    
    function deleteSalesInfo (flag, message, saleId, channelCode, subChannel) {
        $.dialog({
            type: "warn",
            content: message,
            onOk: function () {
                $.openLoading();
                $.ajax({
                    type: "POST",
                    url: "<%=path%>/carDataManagement/deleteSaleInfo",
                    dataType: "JSON",
                    async: false,
                    data: {
                        id: saleId, 
                        flag: flag,
                        channelCode: channelCode,
                        subChannel: subChannel
                    },
                    success: function (data) {
                        $.closeLoading();
                        if($.validate(data))return;
                        queryAgentMtInfo(1);
                    }
                })
            }
        });
    }
    
	function openDeptDiv1(pageIndex,obj){
		$('#deptcode1').val('');
		$('#deptcnname1').val('');
		$("#"+obj.id).blur();
		queryCoreDept1(pageIndex);
	}
	function queryCoreDept1(pageIndex){
		var size = 8;
		var code = $('#deptcode1').val();
		var name = $('#deptcnname1').val();
		var pno = $('#channelCode_1').val();
		queryAllDepts1({size:size,current:pageIndex,deptCode:code,deptName:name,channelCode:pno});
	}
	function queryAllDepts1(param){
		$("#BigDiv2").remove();
		$.openLoading();
		$.ajax({
			url : "carDataManagement/loadCoreDept",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(deptPage){
				$.closeLoading();
				if($.validate(deptPage))return;
						var radioObj ="<input class='input_fxk' name='deptradio' type='radio' value=''>";
						var fieldNames = "DEPT_CODE,DEPT_CNAME";
						var tableContent = creatTable1(fieldNames,deptPage,radioObj);
						var tableObj = $("#deptTable1");
						tableObj.find("tbody").remove();
						tableObj.append(tableContent);
						
						var strPage = creatChannelPage3(param.current,6,deptPage.maxPage,"65");
						var pageDIV = $("#deptPageDIV1");
						pageDIV[0].innerHTML="";
						pageDIV.append(strPage);
						
						$("#deptDiv1").OpenDiv2();
						
						bindradio();
				}
		});
	}
	function chooseDept1(){
		var selectedDept= $("input[name='deptradio']:checked");
		if(selectedDept.length==0){
			$.message("error", "请选择一个出单机构");
			return;
		}
		var deptCode = selectedDept.parent().parent().children(" td:eq(1)").html();
		$('#dept_s').val(deptCode);
		closeSearchDeptDiv();
		}
	function closeSearchDeptDiv(){
		$("#deptDiv1").CloseDiv2();
	}
	function resetSearch(){
		$("#channelCode_s").val("");
		$("#dept_s").val("");
		$("#subChannelCode").val("");
		$("#subChannelName").val("");
	}
	//编辑
	var id = "";
	function editAgentMtInfo(obj){
		handleFlag="update";
		var tempTr = $(obj).parent().parent()[0];
		id = tempTr.childNodes[0].innerHTML;
		$("#branch_div").attr("")
		$("#partnerCode_div").val(tempTr.childNodes[1].innerHTML.split("-")[0]);
		/*2023年4月25日进行优化：因机构名称中可能存在‘-’符号，目前的截取方式不合理。
		$("#branch_div").val(tempTr.childNodes[2].innerHTML.split("-")[0]);
		$("#branchName_div").val(tempTr.childNodes[2].innerHTML.split("-")[1]); */
		var branchStr = tempTr.childNodes[2].innerHTML; // 存储 code - name 的字符串
		var branchStrs = branchStr.split("-");
		if(branchStrs.length == 2){
			$("#branch_div").val(branchStrs[0]);
			$("#branchName_div").val(branchStrs[1]);
		}else {
			$("#branchName_div").val(branchStrs[branchStrs.length-1]);
			var branchCode = "";
			for(var i = 0 ; i < branchStrs.length - 1 ; i ++){
				branchCode += branchStrs[i] + '-';
			}
			branchCode=branchCode.slice(0,branchCode.length - 1)
			$("#branch_div").val(branchCode);
		}
		$("#deptCode_div").val(tempTr.childNodes[3].innerHTML);
		$("#channelCodeQD").val(tempTr.childNodes[4].innerHTML);
		$("#channelType").val(tempTr.childNodes[5].innerHTML);
		$("#newBsnsType").val(tempTr.childNodes[6].innerHTML);
		$("#bsnsType").val(tempTr.childNodes[7].innerHTML);
		$("#empNo_div").val(tempTr.childNodes[12].innerHTML);
		$("#empName_div").val(tempTr.childNodes[13].innerHTML);
		$("#teamCode_div").val(tempTr.childNodes[14].innerHTML);
		$("#teamName_div").val(tempTr.childNodes[15].innerHTML);
		$("#agentNo_div").val(tempTr.childNodes[8].innerHTML);
		$("#protocolNo_div").val(tempTr.childNodes[10].innerHTML);
		$("#cbrkrname_div").val(tempTr.childNodes[9].innerHTML);
		$("#serviceCode_div").val(tempTr.childNodes[11].innerHTML.split("-")[0]);
		$("#serviceName_div").val(tempTr.childNodes[11].innerHTML.split("-")[1]);
		$("#C_AGENCY_CDE").val(tempTr.childNodes[16].innerHTML);
		$("#C_OPR_CDE").val(tempTr.childNodes[17].innerHTML);
		$("#C_SALE_NME").val(tempTr.childNodes[18].innerHTML);
		$("#C_SLS_IDENTITY_NO").val(tempTr.childNodes[19].innerHTML);
		$("#REPAIR_CODE").val(tempTr.childNodes[20].innerHTML);
		$("#REPAIR_NAME").val(tempTr.childNodes[21].innerHTML);
		$("#C_PHONE").val(tempTr.childNodes[22].innerHTML);
		$("#EMP_PHONE").val(tempTr.childNodes[23].innerHTML);
		$("#JQ_Max").val(tempTr.childNodes[24].innerHTML.split("-")[0]);
		$("#JQ_Max_Id").val(tempTr.childNodes[24].innerHTML.split("-")[1]);
		$("#JQ_Min").val(tempTr.childNodes[25].innerHTML.split("-")[0]);
		$("#JQ_Min_Id").val(tempTr.childNodes[25].innerHTML.split("-")[1]);
		$("#SY_Max").val(tempTr.childNodes[26].innerHTML.split("-")[0]);
		$("#SY_Max_Id").val(tempTr.childNodes[26].innerHTML.split("-")[1]);
		$("#SY_Min").val(tempTr.childNodes[27].innerHTML.split("-")[0]);
		$("#SY_Min_Id").val(tempTr.childNodes[27].innerHTML.split("-")[1]);
		$("#userCode_div").attr("readonly","readonly");
		$("#branch_div").attr("readonly","readonly");
		$("#branch_div").css("background","#ccc");
		$("#partnerCode_div").css("background","#ccc");
		$("#partnerCode_div").attr("disabled","disabled");
		if("INSAIC" == tempTr.childNodes[1].innerHTML.split("-")[0]){
			$("#channelCodeQD").attr("disabled","disabled");
			$("#channelType").attr("disabled","disabled");
			$("#newBsnsType").attr("disabled","disabled");
			$("#bsnsType").attr("disabled","disabled");
			$("#channelCodeQD").css("background","#ccc");
			$("#channelType").css("background","#ccc");
			$("#newBsnsType").css("background","#ccc");
			$("#bsnsType").css("background","#ccc");
			$("#agentNo_div").css("background","#ccc");
			$("#agentNo_div").attr("disabled","disabled");
		}
		var newBsnsType = $("#newBsnsType").val();
		var deptCode = $("#deptCode_div").val();
		if(newBsnsTypeStr.indexOf(newBsnsType) != -1){
			$("#C_AGENCY_CDE_ID").html("个人执业证号：")
		}else{
			if(deptCodeStr.indexOf(deptCode.substr(0,2)) != -1){
				$("#C_AGENCY_CDE_ID").html("组织机构代码证号：")
			}else{
				$("#C_AGENCY_CDE_ID").html("机构许可证号：")
			}
		}	
		
		$("#addOrUpdateDiv").OpenDiv();
	}

	
	function batchImport(obj){
		 if (['xls','xlsx'].indexOf(obj.substring(obj.lastIndexOf(".")+1,obj.length)) === -1){
			 $.message("error", "只能上传.XLS.XLSX格式的文件");
			 return;
		 }
		 $.openLoading();
		 $.ajaxFileUpload({
			 url:'<%=path%>/carDataManagement/batchImportAgencyInfoForCar',
			 fileElementId:'excelFile',
		     dataType: 'json',
			 success:function(data){
				 $.closeLoading();
				 $("#excelFile").val("")
		         if(data.result=="error"|| data.result=="fail"){
		        	 $.dialog({
			    		width: 358,
						height: 250,
			    		top:40,
			    		modal:true,
			    		Close:true,
			    		cancel:null,
			    		content: data.message
			    	});
		        	$(".xxDialog").css("overflow","scroll");
			        return;
		        }
		        if($.validate(data)) return;
		        queryAgentMtInfo(1);
			 }
		 });
	}
	function closeNlifeDiv(){
		$("#nlife_div").CloseDiv();
		$("#circuit_id").html("")
		$("#nlifecircuit_div").val("")
		$(".nlifeTradInfo_external").html("");
		$(".nlifeTradInfo_internal").html("");
		$("#circuitFlag").val("")
		$(".nlifeTradInfo_internal").hide();
		$(".nlifeTradInfo_external").hide();
		internalTradInfo = "";
		externalTradInfo = "";
		externalTradInfo_agent = "";
		externalTradInfo_service = "";
		$('#nlifecircuit_div').css('background-color','white');
		$('#nlifecircuit_div').removeAttr('disabled');
	}
	function nlifeConfiguration(obj){
		 $.openLoading();
		var str = $(obj).parent().parent()[0];
		nocarConfigurationTr = str;
		var agentId = str.childNodes[0].innerHTML;
		var channelCode = str.childNodes[1].innerHTML.split("-")[0];
		var subchannelCode = str.childNodes[2].innerHTML.split("-")[0];
		var subchannelName = str.childNodes[2].innerHTML.split("-")[1];
		var key1 = subchannelCode+"_CY";
		var deptCode = str.childNodes[3].innerHTML;
 		$.ajax({
			url : "carDataManagement/nlifeTradAgentInfoQuery",
			type : 'POST',
			async : true,
			data:{"agentId":agentId,"channelCode":channelCode,"key":key1,"subchannelCode":subchannelCode,"deptCode":deptCode},
			dataType:'json',
			success:function(data){
				internalAgent = data.internal_tradinfo;
				externalTradInfo = str;
				externalTradInfo_agent = data.external_agentInfo;
				externalTradInfo_agentName = data.agentInfoName;
				externalTradInfo_service = data.external_serviceInfo;
				if(!(typeof(internalAgent) == "undefined")){
					$("#carSubChannelCode_internal").html(subchannelCode);
					$("#carSubChannelName_internal").html(subchannelName); 
					$("#nlifeSubChannelCode_internal").html(internalAgent.subChannelCode); 
					$("#nlifeChannelCodeQD_internal").html(internalAgent.channleCode); 
					$("#nlifeChannelType_internal").html(internalAgent.channleType); 
					$("#nlifeNewBsnsType_internal").html(internalAgent.newBsnsType); 
					$("#nlifeDeptCode_internal").html(internalAgent.dptCde); 
					$("#nlifeAgentNo_internal").html(internalAgent.agentNo); 
					$("#nlifeProtocolNo_internal").html(internalAgent.protocolNo); 
					$("#nlifeAgentName_internal").html(internalAgent.cbrkrname); 
					$("#nlifeEmpCode_internal").html(internalAgent.empNo); 
					$("#nlifeEmpName_internal").html(internalAgent.empName); 
					$("#nlifeServiceCode_internal").html(internalAgent.serviceCode); 
					$("#nlifeServiceName_internal").html(internalAgent.serviceName); 
					$("#nlifeTeamCode_internal").html(internalAgent.teamCode); 
					$("#nlifeTeamName_internal").html(internalAgent.teamName);
					$('#nlifeProductType_internal').append("<option value=''>-----请选择-----</option>" +
							"<option value='1'>意外险</option>" +
							"<option value='2'>健康险</option>" +
							"<option value='3'>财产险</option>" +
							"<option value='4'>责任险</option>")
					$("#nlifeProductType_internal").val(internalAgent.productType)
                    $("#agentIdOfDel").val(internalAgent.id);
                    $("#channelCodeOfDel").val(internalAgent.channelCode);
                    $("#subChannelCodeOfDel").val(internalAgent.subChannelCode);
					internalTradInfo = internalAgent;
				}
				if("INSAIC"==channelCode){
					$("#circuitFlag").val(data.circuit_flag)
					$("#carSubChannelCode_external").html(subchannelCode);
					$("#carSubChannelName_external").html(subchannelName);
					$("#nlifeSubChannelCode_external").html(subchannelCode);
					$("#nlifeChannelCodeQD_external").html(str.childNodes[4].innerHTML);
					$("#nlifeChannelType_external").html(str.childNodes[5].innerHTML);
					$("#nlifeNewBsnsType_external").html(str.childNodes[6].innerHTML);
					$("#nlifeDeptCode_external").html(str.childNodes[3].innerHTML);
					$("#nlifeAgentNo_external").html(str.childNodes[8].innerHTML);
					$("#nlifeProtocolNo_external").html(str.childNodes[10].innerHTML);
					$("#nlifeAgentName_external").html(str.childNodes[9].innerHTML);
					$("#nlifeEmpCode_external").html(str.childNodes[12].innerHTML);
					$("#nlifeEmpName_external").html(str.childNodes[13].innerHTML);
					$("#nlifeServiceCode_external").html(str.childNodes[11].innerHTML.split("-")[0]);
					$("#nlifeServiceName_external").html(str.childNodes[11].innerHTML.split("-")[1]);
					$("#nlifeTeamCode_external").html(str.childNodes[14].innerHTML);
					$("#nlifeTeamName_external").html(str.childNodes[15].innerHTML);
					// console.log(str)
					// console.log(str.childNodes[16]);
					// $("#nlifeProductType_external").html(str.childNodes[16].innerHTML);
					if(""!=data.external_serviceInfo){
						$("#nlifeServiceCode_external").html(data.external_serviceInfo.split(",")[0]);
						$("#nlifeServiceName_external").html(data.external_serviceInfo.split(",")[1]);
					}
					if(""!=data.external_agentInfo){
						$("#nlifeAgentNo_external").html(data.external_agentInfo.split(",")[0]);
						$("#nlifeProtocolNo_external").html(data.external_agentInfo.split(",")[1]);
						if(typeof(data.external_agentInfo.split("|")[1])!="undefined" && data.external_agentInfo.split("|")[1]!=""){
						$("#nlifeNewBsnsType_external").html(data.external_agentInfo.split("|")[1]);
						}
					}
				}else{
					$("#nlifecircuit_div").val("internal");
					$(".nlifeTradInfo_internal").show();
					$('#nlifecircuit_div').attr("disabled","disabled").css('background-color','#ccc');
					$("#circuit_id").html("<input type='button' id='nlifeInternalTrad' onclick = 'nlifeInternalTradConfig()' style='cursor: pointer;' value='非车销售渠道信息维护'/>")
				}
				$.closeLoading();
			}
		});
		$("#nlife_div").OpenDiv();
	}
	function circuitChange(obj){
		$("#circuit_id").html("")
		if("external" == $(obj).val()){
			$(".nlifeTradInfo_internal").hide();
			$(".nlifeTradInfo_external").show();
			$("#circuit_id").html("<input type='button' id='nlifeExternalService' onclick = 'nlifeExternalServiceConfig()' style='cursor: pointer;' value='非车服务代码维护'/> "+"<input type='button' id='nlifeExternalAgent' onclick = 'nlifeExternalAgentConfig()' style='cursor: pointer;' value='意健险代理人信息维护'/>")
		}
		if("internal" == $(obj).val()){
			$(".nlifeTradInfo_external").hide();
			$(".nlifeTradInfo_internal").show();
			$("#circuit_id").html("<input type='button' id='nlifeInternalTrad' onclick = 'nlifeInternalTradConfig()' style='cursor: pointer;' value='非车销售渠道信息维护'/>")
		}
	}
    function delNlifeSaleInfo (obj) {
        var message = "是否确认删除该网点数据，如点击确认，可进行删除该条网点数据";
        var agentId = obj.parent().children().eq(0).val();
        var channelCode = obj.parent().children().eq(1).val();
        var subChannelCode = obj.parent().children().eq(2).val();
        deleteSalesInfo("deleteCY", message, agentId, channelCode, subChannelCode);
        closeNlifeDiv();
    }
	function nlifeExternalServiceConfig(){
		$("#nlife_div").CloseDiv();
		$("#carSubchannelCode_e").val(externalTradInfo.childNodes[2].innerHTML.split("-")[0])
		if(""!=externalTradInfo_service){
			$("#nlifeServiceCode_e").val(externalTradInfo_service.split(",")[0]);
			$("#nlifeServiceName_e").val(externalTradInfo_service.split(",")[1]);
		}
		
		$("#nlifeServiceDiv").OpenDiv();
		
	}
	function nlifeExternalAgentConfig(){
		var circuitFlag = $("#circuitFlag").val();
		if("Y" == circuitFlag){
			$("#nlifeAgentDivSubCodeDis").attr("style","display:false")
			$("#nlifeAgentDivSubCode").val(externalTradInfo.childNodes[2].innerHTML.split("-")[0]);
		}else{
			$("#nlifeAgentDivDeptCodeDis").attr("style","display:false")
			$("#nlifeAgentDivDeptCode").val(externalTradInfo.childNodes[3].innerHTML);
		}
		if(""!=externalTradInfo_agent){
			console.log(externalTradInfo_agent);
			$("#nlifeAgentDivAgentNo").val(externalTradInfo_agent.split(",")[0]);
			$("#nlifeAgentDivProtocolno").val(externalTradInfo_agent.split(",")[1]);
			if(typeof(externalTradInfo_agent.split(",")[2])!="undefined" && externalTradInfo_agent.split(",")[2]!=""){
				$("#nlifeAgentDivNewbsnsType").val(externalTradInfo_agent.split(",")[2]);
			}
			if(typeof(externalTradInfo_agentName)!="undefined" && externalTradInfo_agentName!=""){
				$("#nlifeAgentDivAgentName").val(externalTradInfo_agentName);
			}
		}
		$("#nlife_div").CloseDiv();
		$("#nlifeAgentDiv").OpenDiv();
		
	}
	function nlifeInternalTradConfig(){
		$("#internalNlifeCarBranchId").val(externalTradInfo.childNodes[2].innerHTML.split("-")[0]);
		$("#internalNlifeCarDept").val(externalTradInfo.childNodes[3].innerHTML);
		$("#internal_car_agentid").val(externalTradInfo.childNodes[0].innerHTML)
		if(""!=internalTradInfo){
			$("#internal_agentid").val(internalTradInfo.id)
			$("#internalNlife_channelCodeQD").val(internalTradInfo.channleCode);
			$("#internalNlife_channelType").val(internalTradInfo.channleType); 
			$("#internalNlife_newBsnsType").val(internalTradInfo.newBsnsType); 
			$("#internalNlife_bsnsType").val(internalTradInfo.categoryCode);
			$("#internalNlife_deptCode").val(internalTradInfo.dptCde); 
			$("#internalNlife_empNo").val(internalTradInfo.empNo); 
			$("#internalNlife_empName").val(internalTradInfo.empName); 
			$("#internalNlife_teamCode").val(internalTradInfo.teamCode); 
			$("#internalNlife_teamName").val(internalTradInfo.teamName); 
			$("#internalNlife_agentNo").val(internalTradInfo.agentNo); 
			$("#internalNlife_protocolNo").val(internalTradInfo.protocolNo); 
			$("#internalNlife_cbrkrname").val(internalTradInfo.cbrkrname); 
			$("#internalNlife_serviceCode").val(internalTradInfo.serviceCode); 
			$("#internalNlife_serviceName").val(internalTradInfo.serviceName); 
			$("#productType").val(internalTradInfo.productType);
		}
		$("#nlife_div").CloseDiv();
		$("#nlifeInternalTradDiv").OpenDiv();
	}
	function colseNlifeConfig(div){
		$("#"+div).CloseDiv();
		if("nlifeAgentDiv" == div){
			$(".nlifeAgentDivInput").val("")
			$("#nlifeAgentDivSubCodeDis").attr("style","display:none")
			$("#nlifeAgentDivDeptCodeDis").attr("style","display:none")
		}
		if("nlifeServiceDiv" == div){
			$(".nlifeServiceDivInput").val("")
		}
		if("nlifeInternalTradDiv" == div){
			$(".internalNlifeInput").val("")
			$(".internalNlifeSelect").val("")
		}
		$("#nlife_div").OpenDiv();
	}
	function saveInternalAgentInfo(){
		var channelCodeQD = $("#internalNlife_channelCodeQD").val();
		var channelType = $("#internalNlife_channelType").val(); 
		var newBsnsType = $("#internalNlife_newBsnsType").val(); 
		var bsnsType = $("#internalNlife_bsnsType").val();
		var deptCode = $("#internalNlife_deptCode").val(); 
		var empNo = $("#internalNlife_empNo").val(); 
		var empName = $("#internalNlife_empName").val(); 
		var teamCode = $("#internalNlife_teamCode").val(); 
		var teamName = $("#internalNlife_teamName").val(); 
		var agentNo = $("#internalNlife_agentNo").val(); 
		var protocolNo = $("#internalNlife_protocolNo").val(); 
		var cbrkrname = $("#internalNlife_cbrkrname").val(); 
		var serviceCode = $("#internalNlife_serviceCode").val(); 
		var serviceName = $("#internalNlife_serviceName").val(); 
		var carAgentid = $("#internal_car_agentid").val();
		var internalNlifeid = $("#internal_agentid").val();
		var subChannelCode = externalTradInfo.childNodes[2].innerHTML.split("-")[0]
		var channelCode = externalTradInfo.childNodes[1].innerHTML.split("-")[0];
		var productType = $('#productType').val();
		if($.trim(channelCodeQD).length==0){
			$.message("error", "请选择归属渠道");
			return;
		}
		if($.trim(channelType).length==0){
			$.message("error", "请选择渠道类型");
			return;
		}
		if($.trim(newBsnsType).length==0){
			$.message("error", "请选择新业务来源");
			return;
		}
		if($.trim(bsnsType).length==0){
			$.message("error", "请选择原业务来源");
			return;
		}
		if($.trim(deptCode).length==0){
			$.message("error", "请选择出单机构");
			return;
		}
		if($.trim(empNo).length==0){
			$.message("error", "请输入业务员代码");
			return;
		}
		if($.trim(empName).length==0){
			$.message("error", "请输入业务员名称");
			return;
		}
		if($.trim(teamCode).length==0){
			$.message("error", "请输入团队代码");
			return;
		}
		if($.trim(teamName).length==0){
			$.message("error", "请输入团队名称");
			return;
		}
		if(bsnsType.substr(0,5)=="19002"||bsnsType.substr(0,5)=="19003"){	
			if( $.trim(agentNo).length==0){
				$.message("error", "请输入代理人编码");
				return;
			}else if($.trim(protocolNo).length==0){
				$.message("error", "请输入代理人协议号");
				return;
			}else if($.trim(cbrkrname).length==0){
				$.message("error", "请输入代理人名称");
				return;
			}
		}
		if($.trim(serviceCode).length==0){
			$.message("error", "请输入服务代码");
			return;
		}
		if($.trim(serviceName).length==0){
			$.message("error", "请输入服务名称");
			return;
		}
		if($.trim(productType).length==0){
			$.message("error", "请选择产品类型");
			return;
		}
		$.openLoading();
		var param = {"carAgentid":carAgentid,"internalNlifeid":internalNlifeid,"channleCode":channelCodeQD,"channleType":channelType,"newBsnsType":newBsnsType,"categoryCode":bsnsType,"dptCde":deptCode,"empNo":empNo,"empName":empName,"teamCode":teamCode,"teamName":teamName,"agentNo":agentNo,"protocolNo":protocolNo,"cbrkrname":cbrkrname,"serviceCode":serviceCode,"serviceName":serviceName,"carSubChannelCode":subChannelCode,"channelCode":channelCode,"productType":productType}
 		$.ajax({
			url : "carDataManagement/savaorupdateInternalTradInfo",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(data){
				$.closeLoading();
				var error = data.error;
				if("0001" == data.resultCode){
					$.message("error",data.result);
					return;
				}
				if(!(typeof(error) == "undefined")){
					$.message("error", error);
					return;
				}
				$.message("success", "添加成功");
				var agentInfo = data.success;
				if(!(typeof(agentInfo) == "undefined")){
					internalTradInfo = agentInfo;
					$("#carSubChannelCode_internal").html(externalTradInfo.childNodes[2].innerHTML.split("-")[0])
					$("#carSubChannelName_internal").html(externalTradInfo.childNodes[2].innerHTML.split("-")[1])
					$("#nlifeSubChannelCode_internal").html(agentInfo.subChannelCode); 
					$("#nlifeChannelCodeQD_internal").html(agentInfo.channleCode); 
					$("#nlifeChannelType_internal").html(agentInfo.channleType); 
					$("#nlifeNewBsnsType_internal").html(agentInfo.newBsnsType); 
					$("#nlifeDeptCode_internal").html(agentInfo.dptCde); 
					$("#nlifeAgentNo_internal").html(agentInfo.agentNo); 
					$("#nlifeProtocolNo_internal").html(agentInfo.protocolNo); 
					$("#nlifeAgentName_internal").html(agentInfo.cbrkrname); 
					$("#nlifeEmpCode_internal").html(agentInfo.empNo); 
					$("#nlifeEmpName_internal").html(agentInfo.empName); 
					$("#nlifeServiceCode_internal").html(agentInfo.serviceCode); 
					$("#nlifeServiceName_internal").html(agentInfo.serviceName); 
					$("#nlifeTeamCode_internal").html(agentInfo.teamCode); 
					$("#nlifeTeamName_internal").html(agentInfo.teamName);
					$("#nlifeProductType_internal").val(agentInfo.productType)
				}
				colseNlifeConfig("nlifeInternalTradDiv")
			}
		});
	}
	function saveNlifeServiceInfo(){
		var serviceCode = $("#nlifeServiceCode_e").val();
		var serviceName = $("#nlifeServiceName_e").val();
		var subChannelCode = $("#carSubchannelCode_e").val();
		if("" == serviceCode || "" == serviceName){
			$.message("error", "服务代码或服务名称不能为空");
			return;
		}
		$.openLoading();
		var param = {"serviceInfo":serviceCode+","+serviceName,"subChannelCode":subChannelCode}
 		$.ajax({
			url : "carDataManagement/savaorupdateServiceInfo",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(data){
				$.closeLoading();
				var error = data.error;
				if(!(typeof(error) == "undefined")){
					$.message("error", error);
					return;
				}
				$.message("success", data.success);
				$("#nlifeServiceCode_external").html(serviceCode);
				$("#nlifeServiceName_external").html(serviceName);
				externalTradInfo_service = serviceCode+","+serviceName;
				colseNlifeConfig('nlifeServiceDiv');
			}
		});
	}
	function saveNlifeAgentInfo(){
			var circuitFlag = $("#circuitFlag").val()
			var agentNo = $("#nlifeAgentDivAgentNo").val();
			var protocolno = $("#nlifeAgentDivProtocolno").val();
			var newBsnsType = $("#nlifeAgentDivNewbsnsType").val();
			var agentName = $("#nlifeAgentDivAgentName").val();
			var agents = ""
			if($.trim(agentNo).length==0){
				$.message("error", "代理人编码不能为空");
				return;
			}
			if($.trim(protocolno).length==0){
				$.message("error", "代理人协议号不能为空");
				return;
			}
			agents = agentNo+","+protocolno;
			if($.trim(newBsnsType).length!=0){
				agents=agents+","+newBsnsType
			}
			var subChannelCode = "";
			var dept = "";
		if("Y"==circuitFlag){
			subChannelCode = $("#nlifeAgentDivSubCode").val();
		}else{
			dept = $("#nlifeAgentDivDeptCode").val();
			if(dept.length==8 || dept.length==6 || dept.length==4 || dept.length==2){
				deptCode = externalTradInfo.childNodes[3].innerHTML;
				if(dept != deptCode.substr(0,dept.length)){
					$.message("error", "仅支持修改当前代理信息机构代码");
					return;
				}
			}else{
				$.message("error", "仅支持2,4,6,8位机构代码");
				return;
			}
		}
		$.openLoading();
		var param = {"subChannelCode":subChannelCode,"dept":dept,"agents":agents,"circuitFlag":circuitFlag,agentName:agentName};
 		$.ajax({
			url : "carDataManagement/savaorupdateAgentsInfo",
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(data){
				$.closeLoading();
				var error = data.error;
				if(!(typeof(error) == "undefined")){
					$.message("error", error);
					return;
				}
				$.message("success", data.success);
				$("#nlifeAgentNo_external").html(agents.split(",")[0]);
				$("#nlifeProtocolNo_external").html(agents.split(",")[1]);
				if(typeof(agents.split(",")[2])!="undefined" && agents.split(",")[2]!=""){
					$("#nlifeNewBsnsType_external").html(agents.split(",")[2]);
				}
				externalTradInfo_agent = agents;
				colseNlifeConfig('nlifeAgentDiv');
			}
		});
	}
	//广东销售渠道信息配置
	var rolemap=new Map();
	function openSalesInfoDiv(obj){
		var tempTr = $(obj).parent().parent()[0];
		var id=tempTr.childNodes[0].innerHTML;
		var deptCode=tempTr.childNodes[3].innerHTML;
		var sale=deptCode.substring(0,2);
		$('#agentId').val(id);
		if(sale=='44'){
			$.openLoading();
			$.ajax({
				url : "carDataManagement/loadSale",
				type : 'POST',
				async : true,
				data:{
					id:id
				},
				dataType:'json',
				success:function(data){
					$.closeLoading();
					if(data.success){
						rolemap.put("saleMenTypes", data.saleMenTypes);
						rolemap.put("saleTypes", data.saleTypes);
						createSale(data.saleAgents);
					}else{
						$.message("error",data.message);
					}
				}
			});
		}else{
			$.message("error","非广东地区业务无需进行配置！");
		}
	}
	/**广东销售*/
	function createSale(agents){
		var salecontent=''
			for (var i = 1; i <= 5; i++) {
				salecontent+='<tr>'+
				'<td>'+i+'<input type="hidden" id="flag'+i+'" value="'+i+'"/></td>'+
				'<td>'+getSale1(i)+'</td>'+	
				'<td><input type="text" onkeyup="clearNoNum(event,this)"  id="saleRate'+i+'" style=" width: 130px"/></td>'+							
				'<td><input type="text" id="saleCallNo'+i+'" class="input_text" style=" width: 130px"/></td>'+								
				'<td>'+getSale(i)+'</select></td>'+
				'<td><input type="text" id="saleMen'+i+'"  class="input_text" style=" width: 130px"/></td>'+								
				'<td><input type="text" id="empNo'+i+'"  class="input_text" style=" width: 130px"/></td>'+							
			'</tr>'
			}
			$('#salecontent').html('');
			$('#salecontent').html(salecontent);
			$('#sale_div').OpenDiv()
			//赋值
			for (var i = 1; i <= agents.length; i++) {
			var o=agents[i-1];
			if(o&&o.planType==4){
				 $('#flag'+o.seqNo).val(o.seqNo);
				 $('#saletype'+o.seqNo).val(o.saleType);
				 $('#saleCallNo'+o.seqNo).val(o.practiceNo);
				 $('#saleMentype'+o.seqNo).val(o.personType);
				 $('#saleMen'+o.seqNo).val(o.salePerson);
				 $('#empNo'+o.seqNo).val(o.empNo);
				 $('#saleRate'+o.seqNo).val(Number(o.agentFee));
			}
		}
	}
	function getSale1(i){
		var roles=rolemap.get("saleTypes");
		var hr='<select id="saletype'+i+'" class="select_1 valid" style=" width: 130px">'
				+'<option value="0">请选择</option>'
			for (var j = 0; j < roles.length; j++) {
				hr+='<option value="'+roles[j].code+'">'+roles[j].codeName+'</option>'
			}
			hr+='</select>';
		return hr;
	}
	function getSale(i){
		var roles=rolemap.get("saleMenTypes");
		var hr='<select id="saleMentype'+i+'" class="select_1 valid" style=" width: 130px">'
				+'<option value="0">请选择</option>'
			for (var j = 0; j < roles.length; j++) {
				hr+='<option value="'+roles[j].code+'">'+roles[j].codeName+'</option>'
			}
			hr+='</select>';
		return hr;
	}
	//销售人员信息保存
	function  saveSale(){
		var salemap1=new Map();
		var arr1 = new Array(); 
		var rate = 0;
		for (var i = 1; i <= 5; i++) {
			var o=new Object();
			var seqNo=$('#flag'+i).val();
			o.seqNo=seqNo;
			o.planType="4";
			//销售员类型 1内部，2外部
			var saletype=$.trim($('#saletype'+i).val());
			//执业证号
			var saleCallNo=$.trim($('#saleCallNo'+i).val());
			//人员类型
			var saleMentype=$('#saleMentype'+i).val();
			//销售员
			var saleMen=$.trim($('#saleMen'+i).val());
			//业务员
			var empNo=$.trim($('#empNo'+i).val());
			//费用比例
			var saleRate=$.trim($('#saleRate'+i).val());
			if(saletype != "0"){
				o.saleType=saletype;
				if(saleRate!=''){
					o.agentFee=saleRate;
					rate = parseFloat(rate)+parseFloat(saleRate)
				}else{
					$.message("error","第"+i+"行：费用比例不能为空！");
					return;
				}
				if(saleCallNo != ''){
					o.practiceNo=saleCallNo;
				}else{
					$.message("error","第"+i+"行：执行证号不能为空！");
					return;
				}
				if(saleMentype != '0'){
					o.personType=saleMentype;
				}else{
					if("1" == saletype){
						$.message("error","第"+i+"行：销售员类型为内部时人员类型不能为空！");
						return;
					}
				}
				if(saleMen != ''){
					o.salePerson=saleMen;
				}else{
					if("2" == saletype){
						$.message("error","第"+i+"行：销售员类型为外部时销售员不能为空！");
						return;
					}
				}
				if(empNo != ''){
					o.empNo=empNo;
				}else{
					if("1" == saletype){
						$.message("error","第"+i+"行：销售员类型为内部时业务员不能为空！");
						return;
					}
				}
				if(i!=1){
					var o1=salemap1.get(i-1);
					if(o1==null||o1==undefined||o1==false){
					$.message("error","序号"+i+"的上一个序号未填写不能跳号");
					return;		
					}
				}
				salemap1.put(i,o);
				arr1.push(o);
			}else{
				if(saleRate!='' || saleCallNo!='' || saleMentype!="0" || saleMen!='' || empNo!=''){
					$.message("error","第"+i+"行数据存在必填项未填写");
					return;	
				}
			}
		}
		if(parseFloat(rate)!=1){
			$.message("error","费用比例之和不等于1！");
			return;	
		}
		$.openLoading();
		var arr=JSON.stringify(arr1);
		var id= $('#agentId').val();
	 	$.ajax({
			url : "carDataManagement/addTradSaleAgent",
			type : 'POST',
			async : true,
			data:{
				id:id,
				saleArry:arr
			},
			dataType:'json',
			success:function(result){
				$.closeLoading();
				if(result.result=='success'){
					closeCarSaleDiv('sale_div');
					$.message("success", "添加成功");
				}else{
					$.message("error", "添加失败");
				}
			}
		});
	}
	function closeCarSaleDiv(div){
		$('#agentId').val("");
		$("#"+div).CloseDiv();
	}

	function chanageProductType() {
		$.openLoading();
		str = nocarConfigurationTr;
		console.log("channelCodeOfDel值为："+$('#channelCodeOfDel').val())
		var channelCode =$('#channelCodeOfDel').val() ;
		var subchannelCode = $('#carSubChannelCode_internal').text();
		var subchannelName = $('#carSubChannelName_internal').text();
		var key1 = subchannelCode+"_CY";

		var deptCode = $('#nlifeDeptCode_internal').text();
		var productType = $('#nlifeProductType_internal').val();
		$.ajax({
			url : "carDataManagement/nlifeTradAgentInfoQuery",
			type : 'POST',
			async : true,
			data:{"agentId":"","channelCode":channelCode,"key":key1,"subchannelCode":subchannelCode,"deptCode":deptCode,"productType":productType},
			dataType:'json',
			success:function(data){
				internalAgent = data.internal_tradinfo;
				if (internalAgent == null || internalAgent == ''){
					$.closeLoading();
					$.message("error", "未配置该渠道信息");
                    $('#nlifeProductType_internal').val(currentProductType);
					return;
				}
				externalTradInfo = str;
				externalTradInfo_agent = data.external_agentInfo;
				externalTradInfo_agentName = data.agentInfoName;
				externalTradInfo_service = data.external_serviceInfo;
				currentProductType = $('#nlifeProductType_internal').val()
				if(!(typeof(internalAgent) == "undefined")){
					$("#carSubChannelCode_internal").html(subchannelCode);
					$("#carSubChannelName_internal").html(subchannelName);
					$("#nlifeSubChannelCode_internal").html(internalAgent.subChannelCode);
					$("#nlifeChannelCodeQD_internal").html(internalAgent.channleCode);
					$("#nlifeChannelType_internal").html(internalAgent.channleType);
					$("#nlifeNewBsnsType_internal").html(internalAgent.newBsnsType);
					$("#nlifeDeptCode_internal").html(internalAgent.dptCde);
					$("#nlifeAgentNo_internal").html(internalAgent.agentNo);
					$("#nlifeProtocolNo_internal").html(internalAgent.protocolNo);
					$("#nlifeAgentName_internal").html(internalAgent.cbrkrname);
					$("#nlifeEmpCode_internal").html(internalAgent.empNo);
					$("#nlifeEmpName_internal").html(internalAgent.empName);
					$("#nlifeServiceCode_internal").html(internalAgent.serviceCode);
					$("#nlifeServiceName_internal").html(internalAgent.serviceName);
					$("#nlifeTeamCode_internal").html(internalAgent.teamCode);
					$("#nlifeTeamName_internal").html(internalAgent.teamName);
					$("#nlifeProductType_internal").val(internalAgent.productType)
					$("#agentIdOfDel").val(internalAgent.id);
					$("#channelCodeOfDel").val(internalAgent.channelCode);
					$("#subChannelCodeOfDel").val(internalAgent.subChannelCode);
					internalTradInfo = internalAgent;
				}
				if("INSAIC"==channelCode){
					$("#circuitFlag").val(data.circuit_flag)
					$("#carSubChannelCode_external").html(subchannelCode);
					$("#carSubChannelName_external").html(subchannelName);
					$("#nlifeSubChannelCode_external").html(subchannelCode);
					$("#nlifeChannelCodeQD_external").html(str.childNodes[4].innerHTML);
					$("#nlifeChannelType_external").html(str.childNodes[5].innerHTML);
					$("#nlifeNewBsnsType_external").html(str.childNodes[6].innerHTML);
					$("#nlifeDeptCode_external").html(str.childNodes[3].innerHTML);
					$("#nlifeAgentNo_external").html(str.childNodes[8].innerHTML);
					$("#nlifeProtocolNo_external").html(str.childNodes[10].innerHTML);
					$("#nlifeAgentName_external").html(str.childNodes[9].innerHTML);
					$("#nlifeEmpCode_external").html(str.childNodes[12].innerHTML);
					$("#nlifeEmpName_external").html(str.childNodes[13].innerHTML);
					$("#nlifeServiceCode_external").html(str.childNodes[11].innerHTML.split("-")[0]);
					$("#nlifeServiceName_external").html(str.childNodes[11].innerHTML.split("-")[1]);
					$("#nlifeTeamCode_external").html(str.childNodes[14].innerHTML);
					$("#nlifeTeamName_external").html(str.childNodes[15].innerHTML);
					// console.log(str)
					// console.log(str.childNodes[16]);
					// $("#nlifeProductType_external").html(str.childNodes[16].innerHTML);
					if(""!=data.external_serviceInfo){
						$("#nlifeServiceCode_external").html(data.external_serviceInfo.split(",")[0]);
						$("#nlifeServiceName_external").html(data.external_serviceInfo.split(",")[1]);
					}
					if(""!=data.external_agentInfo){
						$("#nlifeAgentNo_external").html(data.external_agentInfo.split(",")[0]);
						$("#nlifeProtocolNo_external").html(data.external_agentInfo.split(",")[1]);
						if(typeof(data.external_agentInfo.split("|")[1])!="undefined" && data.external_agentInfo.split("|")[1]!=""){
							$("#nlifeNewBsnsType_external").html(data.external_agentInfo.split("|")[1]);
						}
					}
				}else{
					$("#nlifecircuit_div").val("internal");
					$(".nlifeTradInfo_internal").show();
					$('#nlifecircuit_div').attr("disabled","disabled").css('background-color','#ccc');
					$("#circuit_id").html("<input type='button' id='nlifeInternalTrad' onclick = 'nlifeInternalTradConfig()' style='cursor: pointer;' value='非车销售渠道信息维护'/>")
				}
				$.closeLoading();
			}
		});
		$("#nlife_div").OpenDiv();
	}
	</script>
</head>
<body >
	<div class="current">
		<table class="current_table_1">
			<tbody>
				<tr class="f2">
		            <td>
		              <img src="./images/current_1.jpg">
		            </td>
		            <td class="current_table_1_td">
		              <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
		                <span style=" color:#136bab; ">车险数据管理 &gt; 销售渠道信息维护</span>
		            </td>
		            <td><img src="./images/current_3.jpg"></td>
	        	</tr>
			</tbody>
		</table>
	</div>			
		
	<table class="table_02" id="table">
		<tr>
			<td>
				<table class="search_table">
					<tr  class="h_30">
						<td style="border: 0;text-align: right;width:95px;position:relative;" nowrap="nowrap" class="h_30">合作伙伴代码：</td>
						<td style="position:relative;width: 170px;">
							<select id="channelCode_s" class="search_select_1" id="searchPartner" style="cursor: pointer;width: 130px;">
								<option value="">&nbsp;&nbsp;&nbsp;----请选择----</option>
								<c:forEach var="partner" items="${partners}">
									<option value="${partner.code}">${partner.code}</option>
								</c:forEach>
							</select>
						</td>
						<td style="border: 0;text-align: right;width: 40px;position:relative;" nowrap="nowrap" class="h_30">机构：</td>
						<td style="position:relative;width: 170px;">
							<input id="dept_s"  type="text" class="input_text" value="" readonly="readonly" style="width: 120px; background-color:#ccc;">
							<input type="button"  class="input_button_1" id="searchDeptCode" value="选择" onClick="openDeptDiv1(1,this)"/>
						</td>
						<td style="border: 0;text-align: right;width: 65px;position:relative;" nowrap="nowrap" class="h_30">网点代码：</td>
						<td style="position:relative;width: 125px;">
							<input name="version" id="subChannelCode" type="text" class="input_text" maxlength="30" value="">
						</td>
						<td style="border: 0;text-align: right;width:65px;position:relative;" nowrap="nowrap" class="h_30">网点名称：</td>
						<td style="position:relative;width: 200px">
							<input id="subChannelName" type="text" class="input_text" maxlength="300" style="width: 200px;" value="">

						</td>
					</tr>
					<tr height="30px">
						<td height="30px"  colspan="8" style="text-align: center;">
							<input type="button" class="input_button_1" id="searchBtn" style="cursor: pointer;" value="查询" onClick="queryAgentMtInfo(1)"/>
						    <input type="button" class="input_button_1" id="resetBtn" style="cursor: pointer;" value="重置" onClick="resetSearch()" />
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="search_table">
					<tr class="h_30">
						<td class="h_30">
						    <input type="button" class="input_button_1" style="cursor: pointer;"value="新增" onclick="addAgentInfo()" />
							<input type="file" name="excelFile" id="excelFile"  onchange="batchImport(this.value)" style="display: none;"  accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel " />
							<input type="button" class="input_button_2" id="" style="cursor: pointer;" value="批量导入" onclick="$('#excelFile').click()" />
							<input type="button" class="input_button_2" id="" style="cursor: pointer;" value="模板下载" onclick="agentExcelDownload()" />
							<span class="red">注：批量导入销售渠道信息时，如系统已存在对应网点销售信息，则更新，如不存在，则系统新增对应信息</span>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<div>
					<table id="agentInfoTable" class="content_table_1">
						<thead>
							<tr class="f1">
								<th style="width:8%;">合作伙伴名称</th>
								<th style="width:11%;">网点代码-网点名称</th>
								<th style="width:4%;">出单机构</th>
								<th style="width:5%;">新业务来源</th>
								<th style="width:5%;">代理人编码</th>
								<th style="width:10%;">代理人名称</th>
								<th style="width:5%;">代理人协议号</th>
								<th style="width:10%;">服务代码-服务名称</th>
								<th style="width:11%;">操作</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
				</div>
				<div id="agentInfoPageDIV" class="page"></div>
			</td>
		</tr>
	</table>
	  	<%--添加或修改agentInfo相关数据弹出层 --%>
	  <div id="addOrUpdateDiv" style="display: none;width:600px;height:485px;">
  		<div style="position: absolute;width:600px;height:20px;line-heighe:20px;background-color:#A4BDE3;">
				<table  style='width:100%;height: 20px;'>
					<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="<%=path %>/images/closedown.gif" alt="关闭"  onclick="closeAddOrUpdateDiv()"/></td>
					</tr>
				</table>
		</div>
		<div style="width:600px;height:460px;overflow-y:auto;margin-top: 18px">
		<table class="table_02" align="center" style="height: 65%;width: 95%" >
			<tr id='partnerCode_tr'>
				<td style="text-align:right;border-right:0px;" width="40%">合作伙伴：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<select id="partnerCode_div" class="search_select_1" id="searchPartner" style="cursor: pointer;width: 130px;">
						<option value="">&nbsp;&nbsp;&nbsp;----请选择----</option>
						<c:forEach var="partner" items="${partners}">
						<option value="${partner.code}">${partner.code}</option>
						</c:forEach>
					</select><span class="red">*</span>
				</td>
			</tr>
			<tr class = "branchAgentMtInfo">
				<td style="text-align:right;border-right:0px;" width="40%">网点代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="branch_div" name="branch_div" type="text" maxlength="20" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr class = "branchAgentMtInfo">
				<td style="text-align:right;border-right:0px;" width="40%">网点名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="branchName_div" name="branchName_div" type="text" maxlength="1000" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">出单机构：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="deptCode_div"  type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red">*</span>&nbsp;<input type="button"  class="input_button_2" id="searchDeptBtn" value="请选择" onClick="openDeptDiv(1,this)"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">归属渠道：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="channelCodeQD" class="select_1 valid" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="btcList" items="${btcList}">
                  			<option value="${btcList.code}">${btcList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">渠道类型：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="channelType" class="select_1 valid" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="channelList" items="${channelList}">
                  			<option value="${channelList.code}">${channelList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">新业务来源：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="newBsnsType" class="select_1 valid" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="newBSList" items="${newBSList}">
                  			<option value="${newBSList.code}">${newBSList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">原业务来源：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="bsnsType" class="select_1 valid" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="oldBSList" items="${oldBSList}">
                  			<option value="${oldBSList.code}">${oldBSList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
						<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="empNo_select_div" style="display: none">
              			<select id="empNo_select" onchange="changeEmpNo()" class="select_1"></select>
              		</div>
					<input id="empNo_div" name="empNo_div" type="text" maxlength="20" class="input_text"/><span class="red">*</span>&nbsp;
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="empName_div" name="empName_div" type="text" maxlength="20" class="input_text"/><span class="red">*</span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					 <div id="teamCode_select_div" style="display: none" >
					 		<select id="teamCode_select" onclick="changeTeamCode()" class="select_1"></select>
					 </div>
					<input id="teamCode_div" name="teamCode_div" type="text" maxlength="40" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="teamName_div" name="teamName_div" type="text" maxlength="300" class="input_text"/><span class="red">*</span>
				</td>
			</tr>		
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人编码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="agentNo_select_div" style="display: none">
	                  		<select id="agentNo_select" onchange="changeAgentNo()" class="select_1"></select>
	                 </div>
					<input id="agentNo_div" name="agentNo_div" type="text" maxlength="20" class="input_text"/><span  class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">代理人协议号：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="protocolNo_div" name="protocolNo_div" type="text" maxlength="20" class="input_text"/><span class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">代理人名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="cbrkrname_div" name="cbrkrname_div" type="text" maxlength="20" class="input_text"/><span class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="serviceCode_select_div" style="display: none">
	                  		<select id="serviceCode_select" onchange="changeServiceCode()" class="select_1"></select>
	                 </div>
					<input id="serviceCode_div" name="serviceCode_div" type="text" maxlength="20" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="serviceName_div" name="serviceName_div" type="text" maxlength="20" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%" id="C_AGENCY_CDE_ID">中介机构许可证号：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="C_AGENCY_CDE" name="C_AGENCY_CDE" type="text" maxlength="300" class="input_text"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">出单员UM工号：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="C_OPR_CDE" name="C_OPR_CDE" type="text" maxlength="20" class="input_text"/><span class="red">*</span>
				</td>
			</tr>			
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">深圳双录人员姓名：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="C_SALE_NME" name="C_SALE_NME" type="text" maxlength="20" class="input_text"/><span class="red">深圳地区需提供</span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">深圳双录人员证件号码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="C_SLS_IDENTITY_NO" name="C_SLS_IDENTITY_NO" type="text" maxlength="20" class="input_text"/><span class="red">深圳地区需提供</span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">推荐送修码码值：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="REPAIR_CODE" name="REPAIR_CODE" type="text" maxlength="20" class="input_text"/><span class="red">车商业务必填</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">推荐送修码名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="REPAIR_NAME" name="REPAIR_NAME" type="text" maxlength="20" class="input_text"/><span class="red">车商业务必填</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人电话：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="C_PHONE" name="C_PHONE" type="text" maxlength="20" class="input_text"/><span class="red">特约参数替换</span>
				</td>
			</tr>			
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员电话：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="EMP_PHONE" name="EMP_PHONE" type="text" maxlength="20" class="input_text"/><span class="red">特约参数替换</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%"><span class="red">（交强）</span>代理手续费上限：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="JQ_Max" name="JQ_Max" type="text" maxlength="20" class="input_text" onkeyup="value=value.replace(/[^\d.]/g,'')" />
					<input id="JQ_Max_Id" name="JQ_Max_Id" type="hidden" value=""/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%"><span class="red">（交强）</span>代理手续费下限：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="JQ_Min" name="JQ_Min" type="text" maxlength="20" class="input_text" onkeyup="value=value.replace(/[^\d.]/g,'')" />
					<input id="JQ_Min_Id" name="JQ_Min_Id" type="hidden" value=""/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%"><span class="red">（商业）</span>代理手续费上限：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="SY_Max" name="SY_Max" type="text" maxlength="20" class="input_text" onkeyup="value=value.replace(/[^\d.]/g,'')" />
					<input id="SY_Max_Id" name="SY_Max_Id" type="hidden" value=""/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%"><span class="red">（商业）</span>代理手续费下限：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="SY_Min" name="SY_Min" type="text" maxlength="20" class="input_text" onkeyup="value=value.replace(/[^\d.]/g,'')" />
					<input id="SY_Min_Id" name="SY_Min_Id" type="hidden" value=""/>
				</td>
			</tr>
		</table>
			<div align="center">
		   <input type="button" value="保存" onclick="saveAgentMtInfo()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
	       <input type="button" value="取消" onclick="closeAddOrUpdateDiv()" class="input_button_3"/>
		</div>
		</div>
	</div>
	  	<!--选择合作伙伴 div-->
  		<div id="tradPartnerDiv" style="display:none;width:70%;text-align: center;">
		<input type="hidden" id="row_num" name="row_num" value="0"/>
			<div class="table_title_div">
					<table class="table_title" style='width:100%;height: 20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('tradPartnerDiv')"/></td>
						</tr>
					</table>
			</div>
		<table class="table_02" id="table" style="width:98%">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">合作伙伴代码：<input name="txt3"  id="channelCode"  type="text" class="input_text" value="" >
								&nbsp;合作伙伴名称：<input name="txt3" id="channelName"  type="text" class="input_text" value="">
								&nbsp;<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryTradPartners(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="TradPartnerTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:25%">合作伙伴代码</th>
			                  <th style="width:70%">合作伙伴名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="TradPartnerPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center">
		   <input type="button" id="saveRoleBtn" value="确定" onclick="choosePartner()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		   <input type="button" value="取消" onclick="closeCurrentDIV('tradPartnerDiv')" class="input_button_3"/>
		</div>
	</div>
	<!--   	机构 DIV 默认隐藏-->
	<div id="deptDiv" style="display:none;width:70%;text-align: center;">
  		<input type="hidden" id="row_num" name="row_num" value="0"/>
			<div class="table_title_div">
					<table class="table_title" style='width:100%;height: 20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('deptDiv')"/></td>
						</tr>
					</table>
			</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							 出单机构代码：<input name="txt3"  id="deptcode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 出单机构名称：<input name="txt3" id="deptcnname"  type="text" class="input_text" value="">
								       <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryCoreDept(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="deptTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:25%">出单机构代码</th>
			                  <th style="width:70%">出单机构名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="deptPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="确定" onclick="chooseDept()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCurrentDIV('deptDiv')" class="input_button_3"/>
		</div>
	</div>
		<!--   	机构 DIV 默认隐藏-->
	<div id="deptDiv1" style="display:none;width:70%;text-align: center;">
  		<input type="hidden" id="row_num" name="row_num" value="0"/>
			<div class="table_title_div">
					<table class="table_title" style='width:100%;height: 20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeSearchDeptDiv()"/></td>
						</tr>
					</table>
			</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							机构代码：<input name="txt3"  id="deptcode1"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 机构名称：<input name="txt3" id="deptcnname1"  type="text" class="input_text" value="">
								       <input type="button"  class="input_button_1" id="searchBtn1" value="查询" onClick="queryCoreDept1(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="deptTable1"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:25%">机构代码</th>
			                  <th style="width:70%">机构名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="deptPageDIV1"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn1" value="确定" onclick="chooseDept1()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeSearchDeptDiv()" class="input_button_3"/>
		</div>
		</div>
		<div id="nlife_div" style="display: none;width:600px;height:485px;">
		<input type="hidden" id="circuitFlag" value="">
  		<div style="position: absolute;width:600px;height:20px;line-heighe:20px;background-color:#A4BDE3;">
				<table  style='width:100%;height: 20px;'>
					<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="<%=path %>/images/closedown.gif" alt="关闭"  onclick="closeNlifeDiv()"/></td>
					</tr>
				</table>
		</div>
		<div style="width:600px;height:460px;overflow-y:auto;margin-top: 18px">
		<table class="table_02" align="center" style="height: 65%;width: 95%">
			<tr>
				<td colspan="2" style="line-height:60px;">
						<table class="search_table">
							<tr class="h_30">
								<td class="h_30" style="text-align:center;border-right:0px;">
									<select id="nlifecircuit_div" class="search_select_1"  id="searchPartner" style="cursor: pointer;width: 135px;height:23px;" onchange="circuitChange(this)">
										<option value="">请选择车加非车流程</option>
										<option value="external">车加非车外部流程</option>
										<option value="internal">车加非车通用流程</option>
									</select>
								</td>
								<td id="circuit_id" style="text-align:center;" width="70%">
								</td>
							</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align:centert;line-height:45px;"><span style="font-size:20px;font-weight: bold;">非车销售渠道信息展示</span></td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">车险网点代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="carSubChannelCode_external" class="nlifeTradInfo_external"></span>
					<span id="carSubChannelCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">车险网点名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="carSubChannelName_external" class="nlifeTradInfo_external"></span>
					<span id="carSubChannelName_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">意健险网点代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeSubChannelCode_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeSubChannelCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>		
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">归属渠道：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeChannelCodeQD_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeChannelCodeQD_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">渠道类型：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeChannelType_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeChannelType_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">新业务来源：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeNewBsnsType_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeNewBsnsType_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">出单机构：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeDeptCode_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeDeptCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人编码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeAgentNo_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeAgentNo_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人协议号：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeProtocolNo_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeProtocolNo_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeAgentName_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeAgentName_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeEmpCode_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeEmpCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>			
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeEmpName_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeEmpName_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeServiceCode_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeServiceCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeServiceName_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeServiceName_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeTeamCode_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeTeamCode_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeTeamName_external" class="nlifeTradInfo_external"></span>
					<span id="nlifeTeamName_internal" class="nlifeTradInfo_internal"></span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">产品类型：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<span id="nlifeProductType_external" class="nlifeTradInfo_external"></span>
					<select id="nlifeProductType_internal" onchange="chanageProductType()" class="select_1 valid nlifeTradInfo_internal" style="visibility: visible;background-color: white;">
					</select>
					<%--<span id="nlifeProductType_internal" class="nlifeTradInfo_internal"></span>--%>
				</td>
			</tr>
		</table>
		<div align="center">
            <%-- 删除时按顺序获取值，顺序勿动 --%>
            <input id="agentIdOfDel" type="hidden">
            <input id="channelCodeOfDel" type="hidden">
            <input id="subChannelCodeOfDel" type="hidden">
            <input id="deleteNlifeSaleInfo" type="button" value="删除" onclick="delNlifeSaleInfo($(this))" style="display: none" class="input_button_3 nlifeTradInfo_internal">
	       <input type="button" value="取消" onclick="closeNlifeDiv()" class="input_button_3"/>
		</div>
		</div>
	</div>
	<div id="nlifeAgentDiv" style="display: none; width: 400px; height:230px;">
		<div class="table_title_div">
			<table class="table_title" style='width: 100%; height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img src="<%=path%>/images/closedown.gif" alt="关闭" onclick="colseNlifeConfig('nlifeAgentDiv')" /></td>
				</tr>
			</table>
		</div>
		<table id="addtempletTable" class="table_02">
			<tbody>
				<tr>
					<td>
						<table id="coverageTable" class="content_table_1" border="0" align="center">
							<tbody>
								<tr>
									<td colspan="2">
										<div class="dialogTitle" style="margin-top: 1px">
                               				意健险代理人信息维护
        							</div>
									</td>
								</tr>
								<tr style="text-align: center;display: none;" id="nlifeAgentDivSubCodeDis">
									<td width="40%" style="text-align: right; border-right: 0px;">车险网点代码：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivSubCode" readonly="readonly" style="background-color: #ccc;" class="nlifeAgentDivInput"/></td>
								</tr>
								<tr style="text-align: center;display: none;" id="nlifeAgentDivDeptCodeDis">
									<td width="40%" style="text-align: right; border-right: 0px;">机构代码：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivDeptCode" class="nlifeAgentDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">代理人编码：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivAgentNo" class="nlifeAgentDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">代理人协议号：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivProtocolno" class="nlifeAgentDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">新业务来源：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivNewbsnsType" class="nlifeAgentDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">代理人名称：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeAgentDivAgentName" class="nlifeAgentDivInput"/></td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
		<div align="center">
			<input class="input_button_3" name="" type="button" onclick="saveNlifeAgentInfo()" value="确定">&nbsp; 
			<input class="input_button_3" name="" type="button" onclick="colseNlifeConfig('nlifeAgentDiv')" value="取消">
		</div>
	</div>
	<div id="nlifeServiceDiv" style="display: none; width: 400px; height:190px;">
		<div class="table_title_div">
			<table class="table_title" style='width: 100%; height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img src="<%=path%>/images/closedown.gif" alt="关闭" onclick="colseNlifeConfig('nlifeServiceDiv')" /></td>
				</tr>
			</table>
		</div>
		<table id="addtempletTable"  class="table_02">
			<tbody>
				<tr>
					<td>
						<table id="coverageTable" class="content_table_1" border="0" align="center">
							<tbody>
								<tr>
								<td colspan="2">
								<div class="dialogTitle" style="margin-top: 1px">
                                		意健险服务代码维护
        						</div>
								</td>
								</tr>
								<tr style="text-align: center;" id="nlifeServiceDivSubCodeDis">
									<td width="40%" style="text-align: right; border-right: 0px;">车险网点代码：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="carSubchannelCode_e" readonly="readonly" style="background-color: #ccc;" maxlength="20" class="nlifeServiceDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">意健险服务代码：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeServiceCode_e" class="nlifeServiceDivInput"/></td>
								</tr>
								<tr style="text-align: center">
									<td width="40%" style="text-align: right; border-right: 0px;">意健险服务名称：&nbsp;</td>
									<td width="60%" style="text-align: left"><input id="nlifeServiceName_e" class="nlifeServiceDivInput"/></td>
								</tr>
							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>
		<div align="center">
			<input class="input_button_3" name="" type="button" onclick="saveNlifeServiceInfo()" value="确定">&nbsp; 
			<input class="input_button_3" name="" type="button" onclick="colseNlifeConfig('nlifeServiceDiv')" value="取消">
		</div>
	</div>
	  <div id="nlifeInternalTradDiv" style="display: none;width:600px;height:485px;">
  		<div style="position: absolute;width:600px;height:20px;line-heighe:20px;background-color:#A4BDE3;">
				<table  style='width:100%;height: 20px;'>
					<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="<%=path %>/images/closedown.gif" alt="关闭"  onclick="colseNlifeConfig('nlifeInternalTradDiv')"/></td>
					</tr>
				</table>
		</div>
		<div style="width:600px;height:460px;overflow-y:auto;margin-top: 18px">
		<table class="table_02" align="center" style="height: 65%;width: 95%" >
			<tr >
				<td style="text-align:right;height: 40px;" colspan="2">
					<div class="dialogTitle" style="margin-top: 1px">
                                              意健险代理信息维护
        			</div>				
				</td>
			</tr>
			<tr >
				<td style="text-align:right;border-right:0px;" width="40%">车险网点代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlifeCarBranchId"  type="text" readonly="readonly" style="background-color: #ccc;" maxlength="20" class="internalNlifeInput"/><span class="red">*</span>
					<input id="internal_agentid"  type="hidden" class="internalNlifeInput"/>
					<input id="internal_car_agentid"  type="hidden" class="internalNlifeInput"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">车险出单机构：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlifeCarDept"  type="text" readonly="readonly" style="background-color: #ccc;" class="internalNlifeInput"><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">归属渠道：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="internalNlife_channelCodeQD" class="internalNlifeSelect" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="btcList" items="${btcList}">
                  			<option value="${btcList.code}">${btcList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">渠道类型：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="internalNlife_channelType" class="internalNlifeSelect" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="channelList" items="${channelList}">
                  			<option value="${channelList.code}">${channelList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">新业务来源：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="internalNlife_newBsnsType" class="internalNlifeSelect" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="newBSList" items="${newBSList}">
                  			<option value="${newBSList.code}">${newBSList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">原业务来源：</td>
				<td style="text-align:left;" width="60%">&nbsp;
					 <select id="internalNlife_bsnsType" class="internalNlifeSelect" style="visibility: visible;">
						<option value="">----请选择----</option>
                  		<c:forEach var ="oldBSList" items="${oldBSList}">
                  			<option value="${oldBSList.code}">${oldBSList.codeName}</option>
                  		</c:forEach>
					 </select><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">出单机构：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_deptCode"  type="text" readonly="readonly" style=" background-color: #ccc;" class="internalNlifeInput"><span class="red">*</span>&nbsp;<input type="button"  class="input_button_2" id="searchDeptBtn" value="请选择" onClick="openDeptDiv2(1,this)"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="empNo_select_div" style="display: none">
              			<select id="empNo_select" onchange="changeEmpNo()" class="select_1"></select>
              		</div>
					<input id="internalNlife_empNo" type="text" maxlength="20" class="internalNlifeInput"/><span class="red">*</span>&nbsp;
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">业务员名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_empName" type="text" maxlength="20" class="internalNlifeInput"/><span class="red">*</span>
				</td>
			</tr>	
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_teamCode" type="text" maxlength="40" class="internalNlifeInput"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">团队名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_teamName" type="text" maxlength="300" class="internalNlifeInput"/><span class="red">*</span>
				</td>
			</tr>		
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">代理人编码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="agentNo_select_div" style="display: none">
	                  		<select id="agentNo_select" onchange="changeAgentNo()" class="select_1"></select>
	                 </div>
					<input id="internalNlife_agentNo" type="text" maxlength="20" class="internalNlifeInput"/><span  class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">代理人协议号：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_protocolNo" type="text" maxlength="20" class="internalNlifeInput"/><span class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;"  width="40%">代理人名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_cbrkrname" type="text" maxlength="20" class="internalNlifeInput"/><span class="agentClass">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务代码：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<div id="serviceCode_select_div" style="display: none">
	                  		<select id="serviceCode_select" onchange="changeServiceCode()" class="select_1"></select>
	                 </div>
					<input id="internalNlife_serviceCode" type="text" maxlength="20" class="internalNlifeInput"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">服务名称：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<input id="internalNlife_serviceName" type="text" maxlength="20" class="internalNlifeInput"/><span class="red">*</span>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;border-right:0px;" width="40%">产品类型：</td>
				<td style="text-align:left" width="60%">&nbsp;
					<select id="productType" class="select_1 valid" style="visibility: visible;background-color: white;">
						<option value="">-----请选择-----</option>
						<option value="1">意外险</option>
						<option value="2">健康险</option>
						<option value="3">财产险</option>
						<option value="4">责任险</option>
					</select><span class="red">*</span>
				</td>
			</tr>
		</table>
			<div align="center">
		   <input type="button" value="保存" onclick="saveInternalAgentInfo()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
	       <input type="button" value="取消" onclick="colseNlifeConfig('nlifeInternalTradDiv')" class="input_button_3"/>
		</div>
		</div>
	</div>
		<!--广东分公司配置销售人员信息div-->
  	<div id="sale_div" style="display:none;width:840px; height:240px;">
		<div class="table_title_div" style="width: 840px">
			<table class="table_title" style='width:840px;height: 20px;'>
				<tr>
				<td width="320px" style="font-weight: bold; padding-left: 5px"></td>
				<td width="500px" id="interfaceName"></td>
				<td width="20px" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCarSaleDiv('sale_div')"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="width:840px;" align="center">
			<tr>
				<td>
					<table id="sale3"  class="content_table_1">
						<thead>
							<tr class="f1">
			               	  <th style="width:60px">序号</th>
			                  <th style="width:10px">销售员类型<span style="margin-left: 2px" class="red">*</span></th>
			                  <th style="width:10px">费用比例<span style="margin-left: 2px" class="red">*</span></th>
			                  <th style="width:10px">执行证号<span style="margin-left: -2px" class="red">*</span></th>
			                  <th style="width:10px">人员类型</th>
			                  <th style="width:10px">销售员</th>
			                  <th style="width:10px">业务员</th>
			              	</tr>
						</thead>
						<tbody id='salecontent'>
						</tbody>
					</table>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveSaleBtn" value="保存" onclick="saveSale()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCarSaleDiv('sale_div')" class="input_button_3"/>
		</div>
		<input type="hidden" id="agentId" value=""/>
	</div>
	<input type="hidden" id="agentId" value=""/>
	<div id="Loading" style="display:none" align="center">
		<img src="./images/loading.gif" />
	</div>
</body>
</html>